<extend name="Extends/base"/>
<block name="title">编辑管理员</block>
<block name="css">
</block>
<block name="body_style">class="bgc-f2f4f6"</block>
<block name="body">
    <div class="bgc-f3f3f3 ptb5 plr20 c-border-tb clearfix">
        <b class="c-f16" style="line-height: 40px">编辑管理员</b>
        <a href="javascript:;" class="jump-href fr c-btn c-btn-green c-btn-rounded ml10">刷新</a>
        <a href="javascript:history.back(-1);" class="fr c-btn c-btn-green c-btn-rounded ml10">返回</a>
    </div>
    <div class="pt30 plr20">
        <div class="form-layout form-horizontal-wider">
            <em class="pop-close"></em>
            <form id='myForm'>
                <div class="control-group mb10">
                    <label class="control-label"><sub class="control-sub"></sub> 手机号：</label>
                    <div class="control-form">
                        <input type="text" name="phone" value="{$info.phone}" placeholder="请输入手机号" class="input-text input-text-w350">
                    </div>
                </div>
                <div class="control-group mb10">
                    <label class="control-label"><sub class="control-sub"></sub> 密码：</label>
                    <div class="control-form">
                        <input type="password" name="password" placeholder="请输入密码" class="input-text input-text-w350">
                    </div>
                </div>
                
                <div class="control-group mb10">
                    <label class="control-label"><sub class="control-sub"></sub> 确认密码：</label>
                    <div class="control-form">
                        <input type="password" name="rep_password" placeholder="请输入密码" class="input-text input-text-w350">
                    </div>
                </div>
                
                <div class="control-group mb10">
                    <label class="control-label"><sub class="control-sub"></sub> 管理员类型：</label>
                    <div class="control-form">
                        <div class="cus-sel cus-sel-h33" data-toggle="formSelect">
                            <div class="cus-sel-chosed">
                                <input type="text" name="role" value="{$info.role}" style="display:none;">
                                <span class="cus-sel-chosed-txt" data-value="">
                                    <if condition="$info['role'] eq 1">超级管理员</if>
                                    <if condition="$info['role'] eq 2">系统管理员</if>
                                    <if condition="$info['role'] eq 3">普通管理员</if>
                                </span>
                                <span class="jselect-icon"></span>
                            </div>
                            <div class="cus-sel-list" style="display: none;">
                                <ul>
                                    <li class="empty-sel"><a href="javascript:;" data-value="">-请选择-</a></li>
                                    <li><a href="javascript:;" data-value="1">超级管理员</a></li>
                                    <li><a href="javascript:;" data-value="2">系统管理员</a></li>
                                    <li><a href="javascript:;" data-value="3">普通管理员</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
               
            </form>
            <div class="control-group mb10">
                <label class="control-label"></label>
                <div class="control-form">
                    <a class="edit-btn c-btn c-btn-blue">提交</a>
                </div>
            </div>
        </div>

    </div>
</block>
<block name="js">
    <script type="text/javascript" src="__CST__/js/api.admin.js?v={:C('JS_CSS_VERSION')}"></script>

    
    <script type="text/javascript">
       var currId = "{$info.id}";
        $('.edit-btn').on('click', function () {
            var data = getSeachData();
            doEdit(currId,data, function (res) {
                if (res.Code != 10000) {
                    $.toast(res.Message);
                    return false;
                }

                var url = $.sUrl("/Console/Admin/lists");
                location.href = url;
            });
        });

        /**
         * 获取搜索的数据
         * @returns {{}}
         */
        function getSeachData() {
            var fromData = $('#myForm').serializeArray();
            var data = {};
            $.each(fromData, function () {
                var name = this.name;
                var value = $.trim(this.value);
                if (value) {
                    data[name] = value;
                }
            });
            return data;
        }
    </script>
</block>